import { size } from '@/app/utils';
import React from 'react';
import { View,Pressable,ActivityIndicator,StyleSheet} from 'react-native';
let Button = (props:any)=>{
    return(
      <Pressable onPress={()=>{
        props.onClick && props.onClick();
      }} disabled={props.disabled} >
        <View style={[styles.iconbox,{...props.style},{opacity:props.disabled?0.5:1}]}>
          {props.disabled?<ActivityIndicator style={{marginRight:size(5),marginLeft:size(-25)}} size={props.size} color={props.color?props.color:'#fff'} />:<View style={{width:size(5),marginLeft:props.disabled?size(-25):size(0)}}></View>}
          {props.children}
        </View>
      </Pressable>
    )
}

const styles = StyleSheet.create({
    iconbox:{
        flexDirection:'row',
        alignItems:'center',
        justifyContent:'center',
    }
});

export default Button;